import validator from "validator";
import { isEmpty } from "lodash";

const validateInput = (data) => {
  const errors = {};

  validator.isEmpty(data.username) && (errors.username = "请输入用户名");
  validator.isEmpty(data.password) && (errors.password = "请输入密码");

  return {
    errors,
    isValid: isEmpty(errors),
  };
};

export default validateInput;
